/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.supermercado.business;

import com.supermercado.entities.TipoDocumento;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author WIL
 */
@Stateless
public class TipoDocumentoEJB implements TipoDocumentoEJBLocal {

    @PersistenceContext(unitName = "Supermercado-ejbPU")
    private EntityManager em;

    @Override
    public List<TipoDocumento> getListaDocumento() {
        try {
            return em.createNamedQuery("TipoDocumento.findAll").getResultList();
        } catch (Exception e) {
            return null;
        }
    }

    public void persist(Object object) {
        em.persist(object);
    }

}
